from Base import Base
from selenium.webdriver.common.by import By
import time

class Page(Base):
    # 点击登录
    login_loc=(By.XPATH,'//*[@id="u"]/a[2]')
    def login(self):
        self.click(self.login_loc)

    # 点击用户名密码登录
    yhm_loc=(By.XPATH,'//*[@id="TANGRAM__PSP_3__footerULoginBtn"]')
    def yhm(self):
        self.click(self.yhm_loc)

    # 用户名密码登录
    dy1_loc=(By.XPATH,'//*[@id="TANGRAM__PSP_3__form"]/p[1]')
    def dy1(self):
        self.text(self.dy1_loc)

    name_loc=(By.NAME,'userName')
    def name(self):
        self.send_keys(self.name_loc,'ksxx821')

    password_loc=(By.NAME,'password')
    def password(self):
        self.send_keys(self.password_loc,'ksxx2025821')

    loginbtn_loc=(By.XPATH,'//*[@id="TANGRAM__PSP_3__submit"]')
    def loginbtn(self):
        self.click(self.loginbtn_loc)

    def luoji_baidu_login(self):
        self.open_url('https://www.baidu.com//')
        self.login()
        self.yhm()
        time.sleep(4)
        print('文本断言1，用户名密码',self.dy1())
        self.name()
        self.password()
        self.loginbtn()
        time.sleep(7)